<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    <f:view contentType="text/html">
        <h:head>
            <f:facet name="first">
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
                <title>#{tekster.Opprett_oppg}</title>
                <h:outputStylesheet library="css" name="default.css"/>
            </f:facet>
        </h:head>

        <h:form>
            <h:body>
                <ui:composition template="../templates/template.xhtml">
                    <ui:define name="content">
                        <p:growl id="growl" globalOnly="true" sticky="False" />
                        <h3>#{tekster.Opprett_oppg}</h3>   
                        <p:panelGrid> 
                            <f:facet name="header">


                                <p:row>
                                    <p:column>#{tekster.Velg_kl}</p:column>
                                    <p:column>#{tekster.Velg_op}</p:column>
                                    <p:column>#{tekster.Velg_niv}</p:column>
                                    <p:column>#{tekster.Velg_oppg}</p:column>
                                </p:row>
                            </f:facet>
                            <p:row>
                                <p:column resizable="false" styleClass="columclass">
                                    <p:selectOneListbox id="klasse" requiredMessage="#{tekster.Du_maa_velge_klasse}" required="true" converterMessage="Converter failed" converter="#{klasseConverter}" onchange="submit()" value="#{reg.k}" styleClass="oddColumn" >
                                        <f:selectItems value="#{reg.klasser}" 
                                                       var="klasse"
                                                       itemLabel="#{klasse.toString()}"
                                                       itemValue="#{klasse}"/> 
                                    </p:selectOneListbox>
                                    <p:message for="klasse"/>
                                </p:column>
                                <p:column resizable="false" styleClass="columclass">
                                    <p:selectOneListbox id="operator" requiredMessage="#{tekster.Du_maa_velge_operator}" required="true" value="#{reg.os.operator}" onchange="submit()" styleClass="oddColumn">
                                        <f:selectItem itemValue="+" itemLabel="+"/>
                                        <f:selectItem itemValue="-" itemLabel="-"/>
                                        <f:selectItem itemValue="/" itemLabel="/"/>
                                        <f:selectItem itemValue="*" itemLabel="*"/>
                                    </p:selectOneListbox>
                                    <p:message for="operator"/>
                                </p:column>
                                <p:column styleClass="columclass">
                                    <h:outputText value="Eksisterende oppgavesett:   "/>
                                    <h:outputText value="#{reg.hentNiivaa()}" styleClass="oddColumn" />
                                    <p></p>
                                    <br></br><br></br>

                                    <h:outputText value="Skriv inn et nytt oppgavesett"/>
                                    <h:inputText id="nivaa" value="#{reg.os.nivaa}" required="true" />

                                </p:column>
                                <p:column>
                                    <p:selectManyCheckbox value="#{reg.oppgaver}" styleClass="oddColumn" layout="pageDirection">
                                        <f:selectItems value="#{reg.hentLedigeOppgaver()}" />
                                    </p:selectManyCheckbox>
                                </p:column>

                            </p:row>
                        </p:panelGrid>
                        <p:commandButton update="growl" value="Reg oppgavesett" actionListener="#{reg.regOppgaveSett(e)}"/>
                        <p:commandButton value="#{tekster.Opprett_avb}" action="opprettOppgaver?faces-redirect=true"/>

                    </ui:define>

                    <ui:define name="left">
                        <h:form>
                            <div align="center">
                                <h:outputText value="-Meny-"/>
                                <p:commandButton ajax="false" action="/index.xhtml" value="#{tekster.Meny}"/>

                            </div>
                        </h:form>

                    </ui:define>




                </ui:composition>
            </h:body>
        </h:form>
    </f:view>        



</html>
